-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable jest mocking to work properly with npm3. #554
Comments
Are you using npm3? |
$ npm --version
$ 3.3.4 |
Also see: facebook/react#5183 We don't have a good solution for this yet, unfortunately. |
Manually unmocking |
Workarounds for React:
|
Good to know 'fbjs' was the culprit. For me, even 'babel' and 'core-js' needed to be in that unmocked list. |
For those confused: I made this error go away by making my "jest": {
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/fbjs",
"<rootDir>/node_modules/react-dom",
"<rootDir>/node_modules/react-addons-test-utils"
]
}, |
Thanks @jezen, I made those changes and now the tests are working fine. |
fyi the tentative plan is to wait for Haste 2 in #599 and then I'll fix unmock patterns to be deep-unmocks when they are inside of node_modules. |
any idea of the timeline of when it'll be merged back to master? :) great job in this PR!! |
should be out sometime by the end of this year, that's the plan at least :) |
Will be fixed in 0.9.0. I'll publish a new version of |
Summary:This fixes unmock resolution for node_modules when using npm3. The way this is solved is by checking whether the parent dependency is unmocked and both modules are within a `node_modules` folder. This has taken a while, mainly because it required #599 to be merged. I also added some more caching that makes test runs even faster. The react-native test suite now completes in about 6s (down from 7.5-8s). There might be more in the near future ;) This fixes #554, #730, facebook/react#5183, facebook/relay#832 and will be part of 0.9.0. I'll publish 0.9.0-fb3 today with this fix. Closes #732 Differential Revision: D2959610 fb-gh-sync-id: c374b7a2bcdfddf768905356a08948d9156eb028 shipit-source-id: c374b7a2bcdfddf768905356a08948d9156eb028
0.9.0 has been published and this issue is now properly fixed :) |
update version numbers of packages, and add some extra config to 'jest' that fixes an error that started occuring after the upgrade. See: https://github.com/facebook/jest/issues/554\#issuecomment-148836979
getting following issue while running tests
e\build\transform.js:320:12) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Seeing this issue. Not sure where to begin with it.
The text was updated successfully, but these errors were encountered: